import redis

pool = redis.ConnectionPool(host='47.100.206.200', port='16379', decode_responses=True, password="c", db=2)
r = redis.Redis(connection_pool=pool)
r.set("test_sche", "1")


def puts(url_scheme, expire_s: int, mappings):
    """ hash """
    r.mset("kw_room_", mappings)
    r.expire(url_scheme, expire_s)


def gets(key: str):
    """获取指定数量的room_id"""
    print(r.zrangebyscore("kuaishou_live_room", min=5, max=60))


if __name__ == '__main__':
    puts("xxxxxxxxxxxx", 12, {
        'xxx://asdfasdf/asd1123123----gold=1': 122,
        "xxx://asdfasdfasd/123123123----gold=1": 45
    })
    gets("xxxxxxxxxxxx")
